Skip to content

[WORKFLOW] npmjs publishing OIDC permission#2135

Merged
mmd-afegbua merged 7 commits intodevfrom
npmjs-oidc-permission
Feb 25, 2026
Merged

[WORKFLOW] npmjs publishing OIDC permission#2135
mmd-afegbua merged 7 commits intodevfrom
npmjs-oidc-permission

Conversation

@mmd-afegbua
Copy link
Collaborator

@mmd-afegbua mmd-afegbua commented Jan 26, 2026

This PR:

  • Adds write permission for github workflow to use npmjs' OIDC publishing as against the use of keys that needs to be rotated.
  • Consolidates the former ci.canary and handler.publish-release-packages workflow into one handler.publish-dev-release-packages. This is to enable trusted publishing of npm packages that requires only one workflow file for package, regardless of if it is dev or released.
  • Updates publishing script to use trusted publishing if NPMJS_TOKEN is not supplied.
  • Changes the workflow permission of the workflow affected from write-all to a more granular access control.
  • Updates all repo urls on package.json to point to superfluid-org as it is a requirement to enable trusted publishing.

The configuration needed to enable trusted publishing has been implemented on the NPMJS repository.

Sample of trusted published artefact: https://www.npmjs.com/package/@superfluid-finance/ethereum-contracts/v/1.14.2-dev.dc15170.0

@github-actions
Copy link

Changelog Reminder

Reminder to update the CHANGELOG.md for any of the modified packages in this PR.

  • CHANGELOG.md modified
  • Double check before merge

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mmd-afegbua mmd-afegbua force-pushed the npmjs-oidc-permission branch from 0dff7ae to 445186b Compare February 2, 2026 16:12
Comment on lines +290 to +328
name: Upgrade ethereum-contracts on canary testnet (protocol release version "canary")

if: false # disable this for now

needs: [all-packages-tested]

runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
network: [optimism-sepolia]

defaults:
run:
shell: nix develop .#ci-default -c bash -xe {0}

steps:
- uses: actions/checkout@v4

- uses: DeterminateSystems/nix-installer-action@v13

- name: Build
run: |
yarn install --frozen-lockfile
yarn build

- name: Deploy to ${{ matrix.network }}
run: |
cd packages/ethereum-contracts
npx truffle exec --network ${{ matrix.network }} ops-scripts/deploy-test-environment.js
npx truffle exec --network ${{ matrix.network }} ops-scripts/info-print-contract-addresses.js : addresses.vars
tasks/etherscan-verify-framework.sh ${{ matrix.network }} addresses.vars
env:
RELEASE_VERSION: canary
OPTIMISM_SEPOLIA_MNEMONIC: ${{ secrets.BUILD_AGENT_MNEMONIC }}
OPTIMISM_SEPOLIA_PROVIDER_URL: ${{ secrets.OPTIMISM_SEPOLIA_PROVIDER_URL }}

publish-release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 month ago

Generally, the fix is to explicitly declare permissions for the workflow or for the specific job, giving the GITHUB_TOKEN the least privilege it needs. For a job that only checks out code and pushes nothing back to GitHub, contents: read is sufficient.

The best targeted fix here is to add a permissions block to the upgrade-contracts job, similar to the one already used in the publish-release job but reduced to only what’s needed. The job steps only read repo contents and use secrets to deploy contracts; they do not push commits, create releases, or modify PRs. Therefore, contents: read is adequate.

Concretely, in .github/workflows/handler.publish-dev-release-packages.yml, under the upgrade-contracts job (around line 289), insert:

    permissions:
      contents: read

between the existing if: false # disable this for now and needs: [all-packages-tested]. This change does not alter any behavior besides restricting what the automatically‑provided GITHUB_TOKEN can do when/if the job is enabled.

Suggested changeset 1
.github/workflows/handler.publish-dev-release-packages.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/handler.publish-dev-release-packages.yml b/.github/workflows/handler.publish-dev-release-packages.yml
--- a/.github/workflows/handler.publish-dev-release-packages.yml
+++ b/.github/workflows/handler.publish-dev-release-packages.yml
@@ -291,6 +291,9 @@
 
     if: false # disable this for now
 
+    permissions:
+      contents: read
+
     needs: [all-packages-tested]
 
     runs-on: ubuntu-22.04
EOF
@@ -291,6 +291,9 @@

if: false # disable this for now

permissions:
contents: read

needs: [all-packages-tested]

runs-on: ubuntu-22.04
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmd-afegbua what's this

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No ops. The default permission is set to read at organization level, this will be a redundant permission. Also, we'd discussed auditing the permissions and application of principle of least privilegesin the workflow, its in the backlogs.

@mmd-afegbua mmd-afegbua marked this pull request as ready for review February 2, 2026 16:18
@mmd-afegbua mmd-afegbua merged commit 0964e97 into dev Feb 25, 2026
43 of 47 checks passed
@mmd-afegbua mmd-afegbua deleted the npmjs-oidc-permission branch February 25, 2026 11:43
@github-actions
Copy link

XKCD Comic Relif

Link: https://xkcd.com/2135
https://xkcd.com/2135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants